package com.xinxin.leetcode.problem590;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ShiXinXin
 * @date 2020-02-07 15:07
 */
class Solution {
    class Node {
        public int val;
        public List<Node> children;

        public Node() {
        }

        public Node(int _val) {
            val = _val;
        }

        public Node(int _val, List<Node> _children) {
            val = _val;
            children = _children;
        }
    }

    List<Integer> list = new ArrayList<>();

    public List<Integer> postorder(Node root) {
        if (root == null) {
            return new ArrayList<>();
        }
        for (Node node : root.children) {
            postorder(node);
        }
        list.add(root.val);
        return list;
    }
}
